import request from '@/utils/request'

// 查询采购订单信息列表
export function listPurchaseOrder(query) {
  return request({
    url: '/purchase/purchaseOrder/list',
    method: 'post',
    data: query
  })
}

// 查询采购订单信息详细
export function getPurchaseOrder(id) {
  return request({
    url: '/purchase/purchaseOrder/' + id,
    method: 'get'
  })
}

// 新增采购订单信息
export function addPurchaseOrder(data) {
  return request({
    url: '/purchase/purchaseOrder/add',
    method: 'post',
    data: data
  })
}

// 修改采购订单信息
export function updatePurchaseOrder(data) {
  return request({
    url: '/purchase/purchaseOrder/update',
    method: 'post',
    data: data
  })
}

/* // 发起付款申请
export function paymentApply(data) {
  return request({
    url: '/purchase/purchaseOrder/paymentApply',
    method: 'post',
    data: data
  })
} */

// 删除采购订单信息
export function delPurchaseOrder(id) {
  return request({
    url: '/purchase/purchaseOrder/delete/' + id,
    method: 'post'
  })
}

export function closePurchaseOrder(id) {
  return request({
    url: '/purchase/purchaseOrder/close/' + id,
    method: 'post'
  })
}

export function audit(id){
  return request({
    url: '/purchase/purchaseOrder/audit/' + id,
    method: 'post'
  })
}

export function auditCancel(id){
  return request({
    url: '/purchase/purchaseOrder/auditCancel/' + id,
    method: 'post'
  })
}

/* export function reAudit(id){
  return request({
    url: '/purchase/purchaseOrder/reAudit/' + id,
    method: 'post'
  })
}

export function reAuditCancel(id){
  return request({
    url: '/purchase/purchaseOrder/reAuditCancel/' + id,
    method: 'post'
  })
} */

//部分交货的采购单再次入库
export function reShipNotice(id){
  return request({
    url: '/purchase/purchaseOrder/reShipNotice/' + id,
    method: 'post'
  })
}

export function pay(id){
  return request({
    url: '/purchase/purchaseOrder/pay/' + id,
    method: 'post'
  })
}

export function payCancel(id){
  return request({
    url: '/purchase/purchaseOrder/payCancel/' + id,
    method: 'post'
  })
}



// 查询采购订单状态统计信息
export function findPurOrderStatusCount(query) {
  return request({
    url: '/purchase/purchaseOrder/findPurOrderStatusCount',
    method: 'post',
    data: query
  })
}

// 获取操作状态数据
export function findOptStatusData(id) {
  return request({
    url: '/purchase/purchaseOrder/findOptStatusData/' + id,
    method: 'post'
  })
}

// 效期审核
export function expireDateAudit(id) {
  return request({
    url: '/purchase/purchaseOrder/expireDateAudit/' + id,
    method: 'post'
  })
}